package com.nbsaas.boot.project.rest.convert;

import com.nbsaas.boot.project.data.entity.DataModel;
import com.nbsaas.boot.project.api.domain.response.DataModelResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 实体对象转化成响应对象
*/

public class DataModelResponseConvert  implements Converter<DataModelResponse,DataModel> {

    @Override
    public DataModelResponse convert(DataModel source) {
        DataModelResponse  result = new  DataModelResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getProject()!=null){
                        result.setProject(source.getProject().getId());
                    }
                    if(source.getProject()!=null){
                        result.setProjectName(source.getProject().getName());
                    }
        return result;
    }

}

